Skip to main content

Variable declaration usage distance

Checks for variables that are defined before they might be used. A declaration is deemed to be premature if there are some statements that may return or throw an exception between the time the variable is declared and the time it is first read.

Some variables cannot be declared close to their first usage because of side-effects occurring before they’re first used. We try to avoid reporting those by considering most logic invocations to be impure.